package com.ruoyi.dormitory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.dormitory.mapper.DormitoryItemsMapper;
import com.ruoyi.dormitory.domain.DormitoryItems;
import com.ruoyi.dormitory.service.IDormitoryItemsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 宿舍物品Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-26
 */
@Service
public class DormitoryItemsServiceImpl implements IDormitoryItemsService 
{
    @Autowired
    private DormitoryItemsMapper dormitoryItemsMapper;

    /**
     * 查询宿舍物品
     * 
     * @param itemNumber 宿舍物品主键
     * @return 宿舍物品
     */
    @Override
    public DormitoryItems selectDormitoryItemsByItemNumber(Long itemNumber)
    {
        return dormitoryItemsMapper.selectDormitoryItemsByItemNumber(itemNumber);
    }

    /**
     * 查询宿舍物品列表
     * 
     * @param dormitoryItems 宿舍物品
     * @return 宿舍物品
     */
    @Override
    public List<DormitoryItems> selectDormitoryItemsList(DormitoryItems dormitoryItems)
    {
        return dormitoryItemsMapper.selectDormitoryItemsList(dormitoryItems);
    }

    /**
     * 新增宿舍物品
     * 
     * @param dormitoryItems 宿舍物品
     * @return 结果
     */
    @Override
    public int insertDormitoryItems(DormitoryItems dormitoryItems)
    {
      /*  dormitoryItems.setCreateTime(DateUtils.getNowDate());
        return dormitoryItemsMapper.insertDormitoryItems(dormitoryItems);*/
        return dormitoryItemsMapper.insert(dormitoryItems);
    }

    /**
     * 修改宿舍物品
     * 
     * @param dormitoryItems 宿舍物品
     * @return 结果
     */
    @Override
    public int updateDormitoryItems(DormitoryItems dormitoryItems)
    {
     /*   dormitoryItems.setUpdateTime(DateUtils.getNowDate());
        return dormitoryItemsMapper.updateDormitoryItems(dormitoryItems);*/
        return dormitoryItemsMapper.updateById(dormitoryItems);
    }

    /**
     * 批量删除宿舍物品
     * 
     * @param itemNumbers 需要删除的宿舍物品主键
     * @return 结果
     */
    @Override
    public int deleteDormitoryItemsByItemNumbers(String itemNumbers)
    {
        return dormitoryItemsMapper.deleteDormitoryItemsByItemNumbers(Convert.toStrArray(itemNumbers));
    }

    /**
     * 删除宿舍物品信息
     * 
     * @param itemNumber 宿舍物品主键
     * @return 结果
     */
    @Override
    public int deleteDormitoryItemsByItemNumber(Long itemNumber)
    {
        return dormitoryItemsMapper.deleteDormitoryItemsByItemNumber(itemNumber);
    }
}
